#include <iostream>
#include <cstdlib>
using namespace std;

class Solution
{
  public:
    int rand7()
    {
        return rand() % 7 + 1;
    }
    int rand10()
    {
        int x;
        do
        {
            x = 7 * (rand7() - 1) + rand7();
        } while (x > 40);
        return x % 10 + 1;
    }
};

int main()
{
    for (int i = 0; i < 100; i++)
    {
        cout << Solution().rand10() << " ";
    }
    cout << Solution().rand10() << endl;
    return 0;
}
